<?php
	require_once("View/MemberView.php");
	require_once("Model/MemberCatalogModel.php");
	require_once("Model/BoatCatalogModel.php");
	require_once("View/NavigationView.php");
	
	class MemberCatalogController
	{
		public function DoControll(Database $db)
		{
			$mm = new MemberCatalogModel($db);
			$bcm = new BoatCatalogModel($db);
			$bv = new BoatView();
			$mv = new MemberView();
			
			$html = null;
			
			if(NavigationView::UserWantsToViewList() == true)
			{
				$html = $mv->RenderHeader(MemberView::LIST_MEMBER_HEADER);
				
				$html .= $mv->RenderSmallMemberList($mm->GetMembers());
			}
			else if(NavigationView::UserWantsToViewDetailedList() == true)
			{
				$html = $mv->RenderHeader(MemberView::FULL_LIST_MEMBER_HEADER);
							
				$html .= $mv->RenderBigMemberList($mm->GetMembers(), $bcm->GetBoats());
				
			}
			else if (NavigationView::UserWantsToViewSpecificMember() == true)
			{
				$html = $mv->RenderHeader(MemberView::SPECIFIC_MEMBER_HEADER);
				
				$memberObject = NavigationView::GetSelectedMember($mm);
				
				$html .= $mv->RenderSpecificMember($memberObject);
				
				$html .= $bv->RenderSpecificBoat($memberObject->GetID(), $bcm->GetBoats());
			}
			
			return $html;
		}
			
	}

?>